/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-05-04 09:50:21
 * @LastEditTime : 2023-07-11 08:26:06
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\FirstLevel\Api.jsx
 * @Description  :
 */
import { API_LIST } from '../../../Api/Api'
import { commonTableList } from '../Common/common'
import { AddDataButton, ModDataButton, DelDataButton, SelectExcelButton, OpenSelection } from '../Common/options'

export const LaborCompanyBlackLists = async ({ url, OptionsEvent, ClientData, Permission, actionRef }) => {
    let data = {
        pageSize: 10,
        params: { pageIndex: 1 },
        get: API_LIST()[`get${url}`],
        added: `pos${url}`,
        modify: `put${url}`,
        delete: `del${url}`,
        options: [
            <SelectExcelButton
                key="excel"
                title="导出黑名单"
                OptionsEvent={OptionsEvent}
                api={API_LIST()['getLaborCompanyBlackListExcel']}
            />,
            <AddDataButton OptionsEvent={OptionsEvent} type="primary" icon="add" title="新增" />,
            <OpenSelection
                danger
                key="delete"
                title="批量删除"
                type="primary"
                OptionsEvent={OptionsEvent}
                data={{ type: 'SelectionDelete', url: 'posBatchRemovelaborCompanyBlack' }}
            />,
        ],
        columns: [
            { ...commonTableList.SearchSort, selectType: 'LaborCompanyBlackLists' },
            commonTableList.uuid,
            { ...commonTableList.tableName },
            {
                dataIndex: 'contactPersonName',
                title: '联系人',
                valueType: 'input',
                ellipsis: true,
                rules: true,
                width: 150,
            },
            {
                dataIndex: 'mobile',
                title: '联系电话',
                valueType: 'input',
                ellipsis: true,
                rules: true,
                width: 150,
            },
            {
                dataIndex: 'laborCompany',
                title: '劳务公司',
                valueType: 'input',
                ellipsis: true,
                rules: true,
                width: 150,
            },
            {
                dataIndex: 'reason',
                title: '拉黑原因',
                valueType: 'textarea',
                ellipsis: true,
                rules: true,
                width: 150,
            },
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 80,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        <ModDataButton OptionsEvent={OptionsEvent} key="modify" title="修改" data={record} />,
                        <DelDataButton
                            OptionsEvent={OptionsEvent}
                            key="del"
                            title="删除"
                            url={url}
                            uuid={record.uuid}
                        />,
                    ]
                },
            },
        ],
    }

    return data
}
